package Algorithm;

public class WordReverse {
    public static String wordReverse(String iniString){
        String[] words=iniString.split("\\s");
        for(int i=0;i<words.length;i++){
            String tmp=null;
            tmp=words[i];
            words[i]=words[words.length-i-1];
            words[words.length-i-1]=tmp;
        }
        StringBuilder stringBuilder=new StringBuilder();
        for(int i=0;i< words.length;i++){
            stringBuilder.append(words[i]+" ");
        }
        return stringBuilder.toString();
    }
    public static void main(String[] args) {
        System.out.println(wordReverse("are you here"));
    }
}
